package com.xh.bussiness.resource.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xh.bussiness.course.model.CourseIndex;
import com.xh.bussiness.course.service.ICourseIndexService;
import com.xh.bussiness.resource.bean.dto.MaterialDto;
import com.xh.bussiness.resource.bean.request.MaterialCourseIndexRequest;
import com.xh.bussiness.resource.constant.MaterialType;
import com.xh.bussiness.resource.dao.MaterialCourseIndexMapper;
import com.xh.bussiness.resource.dao.PaperCourseIndexMapper;
import com.xh.bussiness.resource.model.MaterialCourseIndex;
import com.xh.bussiness.resource.model.PaperCourseIndex;
import com.xh.bussiness.resource.service.IMaterialCourseIndexService;
import com.xh.bussiness.resource.service.IPaperCourseIndexService;
import com.xh.bussiness.tiku.model.Paper;
import com.xh.core.service.impl.BaseServiceImpl;
import com.xh.core.util.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;

import java.util.*;
import java.util.stream.Collectors;

@Service
public class PaperCourseIndexServiceImpl extends BaseServiceImpl<PaperCourseIndexMapper, PaperCourseIndex> implements IPaperCourseIndexService {

    @Override
    public List<PaperCourseIndex> queryByCourseIndexId(String courseIndexId) {
        QueryWrapper<PaperCourseIndex> qw = new QueryWrapper<>();
        qw.eq("course_index_id",courseIndexId);
        return super.queryByCondition(qw);
    }

    @Override
    public void deleteByCourseIndex(String courseIndexId) {
        this.dao.deleteByCourseIndex(courseIndexId);
    }

    @Override
    public List<Paper> queryPaperByCourseIndex(String courseIndexId) {
        return this.dao.queryPaperByCourseIndex(courseIndexId);
    }
}
